import tensorflow.keras.backend as K


def multiply(x, y):
    assert x.shape == y.shape
    shape = x.shape
    x = K.flatten(x)
    x = K.reshape(x, (x.shape[0], 1))
    y = K.flatten(y)
    y = K.reshape(y, (y.shape[0], 1))
    p = K.prod(K.concatenate([x, y], axis=1), axis=1)
    p = K.reshape(p, shape)
    return p
